[#import "/framework/JGP.htm"  as JGP]
<!--
项目   jgp-cloud-parent
作者   LOUFEI [Gavin]
时间   2018/12/4
-->
[@JGP.head "待办任务"]
    <style>
        .is-important{
            color: red;
        }
    </style>
[/@JGP.head]
[@JGP.body]
    <jgp-div _row="['30','*']" _runit="px">
        <jgp-query slot="1-1" _target="grid" _action="/workflow/processApiController/queryNotHandledTask/${userId!'null'}">
            <jgp-text _name="sn" _placeholder="请输入工单号" _col="4"></jgp-text>
            <jgp-text _name="procName" _placeholder="请输入工单类型" _col="4"></jgp-text>
            <jgp-text _name="taskName" _placeholder="请输入任务名称" _col="4"></jgp-text>
        </jgp-query>
        <jgp-grid slot="2-1"
                  _id="grid"
                  _check="false"
                  _record_tools="[{'icon':'edit','tip':'处理','fn':'taskHandlerDialog'},
                  {'icon':'edit','tip':'查看流程图','fn':'showProcessPic'}]">
            <jgp-grid-col _name="sn" _underline="true" _fns="['taskHandlerDialog']" _filter_render="filterImportantFn" ></jgp-grid-col>
            <jgp-grid-col _name="orderContent" _filter_render="filterImportantFn" ></jgp-grid-col>
            <jgp-grid-col _name="name" _filter_render="filterImportantFn" ></jgp-grid-col>
            <jgp-grid-col _name="procName" _filter_render="filterImportantFn" ></jgp-grid-col>
            <jgp-grid-col _name="startUserName" _filter_render="filterImportantFn" ></jgp-grid-col>
            <jgp-grid-col _name="createTime" _filter_render="filterImportantFn" ></jgp-grid-col>
        </jgp-grid>
    </jgp-div>
[/@JGP.body]

[@JGP.foot]
    <script>
        function showProcessPic(data) {
            var procId = data.back.record.procId;
            var config = {
                title:'流程图',
                url: '/workflow/processController/showProcessPic/' + procId
            };
            JGP.$dialog(config);
        }

        function taskHandlerDialog(data) {
            var busiFormConfig = {
                procId: data.back.record.procId,
                taskId: data.back.record.taskId,
                editFlag: true
            };
            var dialogConfig = {
                title: '任务处理',
                width: '900px',
                callback: function () {
                    location.reload();
                }
            };
            new JGP.Task().taskHandlerDialog(busiFormConfig, dialogConfig);
        }

        function filterImportantFn(data) {
            var record = data.back.record;
            if(record && record.priority == 100){
                return 'is-important'
            }
        }
    </script>
[/@JGP.foot]